package com.ssy.lingxi.after.sale.service;

import com.ssy.lingxi.after.sale.api.model.vo.request.*;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsDetailListResponse;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsInfoVO;
import com.ssy.lingxi.after.sale.api.model.vo.response.ReturnGoodsTaxVO;
import com.ssy.lingxi.after.sale.model.vo.request.*;
import com.ssy.lingxi.after.sale.model.vo.response.*;
import com.ssy.lingxi.common.model.dto.UserLoginCacheDTO;
import com.ssy.lingxi.common.response.PageData;
import com.ssy.lingxi.common.response.Wrapper;

import java.util.List;

/**
 * 售后退货服务接口
 * @author 伍将
 * @date 2020/9/4
 * @version 2.0.0
 */
public interface IReturnGoodsService {

    /**
     * 消费者分页查询退货申请
     * @author 伍将
     * @date 2020/9/4
     * @param user: 
     * @param pageVO: 
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsApplyQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageByConsumer(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 消费者分页查询退货申请-app
     * @param user
     * @param pageVO
     * @return
     */
    Wrapper<PageData<ReturnGoodsQueryAppVO>> pageByConsumerApp(UserLoginCacheDTO user, ReturnGoodsPageAppVO pageVO);

    /**
     * 消费者获取退货申请详情
     * @author 伍将
     * @date 2020/9/4
     * @param user: 当前登录用户
     * @param returnId: 退货id
     * @return 操作结果
     **/
    Wrapper<ReturnGoodsDetailVO> getDetailByConsumer(UserLoginCacheDTO user, Long returnId);

    /**
     * App端获取退货详情
     * @author 伍将
     * @date 2021/3/18
     * @param user: 当前登录用户
     * @param returnId: 退货id
     * @return 操作结果
     **/
    Wrapper<ReturnGoodsDetailAppVO> getDetailByApp(UserLoginCacheDTO user, Long returnId);

    /**
     * 消费者分页查询等待提交的退货
     * @author 伍将
     * @date 2020/9/10
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.repair.response.RepairApplyQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeSubmitByConsumer(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 保存退货申请
     * @author 伍将
     * @date 2020/9/4
     * @param user:
     * @param saveVO:
     * @return com.ssy.lingxi.common.response.Wrapper<java.lang.Long>
     **/
    Wrapper<Long> save(UserLoginCacheDTO user, ReturnGoodsSaveVO saveVO);

    /**
     * 删除退货申请
     * @author 伍将
     * @date 2020/9/4
     * @param user:
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> delete(UserLoginCacheDTO user, Long returnId);

    /**
     * 提交退货申请
     * @author 伍将
     * @date 2020/9/4
     * @param user:
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> submit(UserLoginCacheDTO user, Long returnId);

    /**
     * 供应商分页查询退货申请
     * @author 伍将
     * @date 2020/9/4
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsApplyQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageBySupplier(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 供应商获取退货申请详情
     * @author 伍将
     * @date 2020/9/4
     * @param user:
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.after.sale.model.vo.repair.response.RepairApplyDetailVO>
     **/
    Wrapper<ReturnGoodsDetailVO> getDetailBySupplier(UserLoginCacheDTO user, Long returnId);

    /**
     * 供应商分页查询待提交退货
     * @author 伍将
     * @date 2020/9/10
     * @param user: 
     * @param pageVO: 
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeSubmitBySupplier(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 提交审核
     * @author 伍将
     * @date 2020/9/10
     * @param user: 
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> submitVerify(UserLoginCacheDTO user, ReturnSubmitVerifyVO verifyVO);

    /**
     * 供应商分页查询待审核一级退货
     * @author 伍将
     * @date 2020/9/10
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeVerifyStepOne(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 一级审核
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> verifyStepOne(UserLoginCacheDTO user, VerifyVO verifyVO);

    /**
     * 供应商分页查询待审核二级退货
     * @author 伍将
     * @date 2020/9/10
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeVerifyStepTwo(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 二级审核
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> verifyStepTwo(UserLoginCacheDTO user, VerifyVO verifyVO);

    /***
     * 供应商分页查询等待确认审核的退货
     * @author 伍将
     * @date 2020/9/10
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeConfirmVerify(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认审核
     * @author 伍将
     * @date 2020/9/10
     * @param user:
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmVerify(UserLoginCacheDTO user, VerifyVO verifyVO);

    /**
     * 分页查询待退货发货单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeAddReturnDeliveryGoods(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 新增退货发货单
     * @author 伍将
     * @date 2020/9/24
     * @param addVO: 
     * @return com.ssy.lingxi.common.response.Wrapper<java.lang.Long>
     **/
    Wrapper<Long> addReturnDeliveryGoods(UserLoginCacheDTO user,ReturnDeliveryGoodsAddVO addVO);

    /**
     * 删除退货发货单
     * @author 伍将
     * @date 2020/9/29
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> deleteReturnDeliveryGoods(Long returnId);

    /**
     * 审核退货发货
     * @author 伍将
     * @date 2020/9/24
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> verifyReturnDeliveryGoods(VerifyDeliveryVO verifyVO);

    /**
     * 采购商审核发货单
     * @author 伍将
     * @date 2021/1/4
     * @param user: 当前操作用户
     * @param returnId:退货id
     * @return:
     **/
    Wrapper<Void> verifyReturnDeliveryGoodsByConsumer(UserLoginCacheDTO user, Long returnId);

    /**
     * 分页查询待新增物流单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeAddLogisticsByConsumer(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 新增退货物流
     * @author 伍将
     * @date 2020/9/24
     * @param addVO: 
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> addReturnLogistics(AddLogisticsVO addVO);

    /**
     * 删除退货物流
     * @author 伍将
     * @date 2020/9/29
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> deleteReturnLogistics(Long returnId);

    /**
     * 审核退货物流单
     * @author 伍将
     * @date 2020/9/24
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> verifyReturnLogistics(VerifyLogisticsVO verifyVO);

    /**
     * 分页查询待退货发货单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeReturnDeliveryGoods(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认退货发货
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param deliveryId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmReturnDeliveryGoods(UserLoginCacheDTO user, Long deliveryId);

    /**
     * 手工退货发货
     * @author 伍将
     * @date 2020/12/5
     * @param user:
     * @param deliveryGoodsVO:
     * @return:
     **/
    Wrapper<Void> manualReturnDeliveryGoods(UserLoginCacheDTO user, ManualDeliveryGoodsVO deliveryGoodsVO);

    /**
     * 手工退货发货-新
     * @param sysUser
     * @param returnManualGoodsVO
     * @return
     */
    Wrapper<Void> manualReturnDeliveryGoodsCommon(UserLoginCacheDTO sysUser, ReturnManualGoodsVO returnManualGoodsVO);

    /**
     * 分页查询待新增退货入库单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeAddReturnGoodsStorage(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 新增退货入库单[旧]
     * @author 伍将
     * @date 2020/9/24
     * @param addVO: 
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> addReturnGoodsStorage(ReturnAddStorageVO addVO);
    /**
     * 新增退货入库单[新]
     * @author 伍将
     * @date 2020/9/24
     * @param addVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> addReturnGoodsStorage(UserLoginCacheDTO user, ReturnReceiveAddVO addVO);

    /**
     * 删除退货入库单
     * @author 伍将
     * @date 2020/9/29
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> deleteReturnGoodsStorage(Long returnId);

    /**
     * 审核退货入库单
     * @author 伍将
     * @date 2020/9/24
     * @param verifyVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> verifyReturnGoodsStorage(VerifyDeliveryVO verifyVO);

    /**
     * 供应商审核入库单
     * @author 伍将
     * @date 2021/1/4
     * @param user: 当前操作用户
     * @param returnId:退货id
     * @return 统一数据模型
     **/
    Wrapper<Void> verifyReturnGoodsStorageBySupplier(UserLoginCacheDTO user, Long returnId);

    /**
     * 分页查询待退货收货
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeReturnReceiveGoods(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认退货收货
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param deliveryId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmReturnReceiveGoods(UserLoginCacheDTO user, Long deliveryId);

    /**
     * 确认手工退货收货
     * @author 伍将
     * @date 2020/12/5
     * @param user:
     * @param returnId:
     * @return:
     **/
    Wrapper<Void> confirmManualReturnReceiveGoods(UserLoginCacheDTO user, Long returnId);

    /**
     * 确认退货收货-（手工多批次）
     * @param sysUser
     * @param dataId
     * @return
     */
    Wrapper<Void> confirmManualReturnReceiveGoodsCommon(UserLoginCacheDTO sysUser, Long dataId);

    /**
     * 分页查询待确认退货回单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeConfirmReturnGoodsReceipt(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认退货回单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param deliveryId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmReturnGoodsReceipt(UserLoginCacheDTO user, Long deliveryId);

    /**
     * 继续退货发货
     * @param user
     * @param replaceId
     * @return
     */
    Wrapper<Void> continueReturnDeliveryGoods(UserLoginCacheDTO user, Long replaceId);

    /**
     * 确认全部退货回单
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmAllReturnGoodsReceipt(UserLoginCacheDTO user, Long returnId);

    /**
     * 分页查询待退款
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeRefund(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 退款
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param refundVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> refund(UserLoginCacheDTO user, RefundVO refundVO);

    /**
     * 完成退款
     * @author 伍将
     * @date 2020/12/9
     * @param user:
     * @param commonIdVO:
     * @return:
     **/
    Wrapper<Void> completeRefund(UserLoginCacheDTO user, CommonIdVO commonIdVO);

    /**
     * 分页查询待确认退款
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeConfirmRefund(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认退款
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param confirmRefundVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmRefund(UserLoginCacheDTO user, ReturnGoodsConfirmRefundVO confirmRefundVO);

    /**
     * 确认全部退款
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param returnId:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmAllRefund(UserLoginCacheDTO user, Long returnId);

    /**
     * 分页查询待待确认售后完成
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param pageVO:
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.common.response.PageData < com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsQueryVO>>
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeComplete(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 确认售后完成
     * @author 伍将
     * @date 2020/9/24
     * @param user:
     * @param completeVO:
     * @return com.ssy.lingxi.common.response.Wrapper
     **/
    Wrapper<Void> confirmComplete(UserLoginCacheDTO user, ReturnConfirmCompleteVO completeVO);

    /**
     * 分页查询列表页面搜索条件内容
     * @author 伍将
     * @date 2020/10/17
     * @param user: 
     * @return com.ssy.lingxi.common.response.Wrapper<com.ssy.lingxi.after.sale.model.vo.response.ReturnGoodsPageItemsVO>
     **/
    Wrapper<ReturnGoodsPageItemsVO> pageItems(UserLoginCacheDTO user);

    /**
     * 平台分页查询退货申请
     * @author 伍将
     * @date 2020/12/7
     * @param user:
     * @param pageVO:
     * @return:
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageByPlatform(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 平台分页查询退货退款申请
     * @author 伍将
     * @date 2020/12/7
     * @param user:
     * @param pageVO:
     * @return:
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageRefundByPlatform(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 平台查询退货申请详情
     * @author 伍将
     * @date 2020/12/7
     * @param user:
     * @param returnId:
     * @return:
     **/
    Wrapper<ReturnGoodsDetailVO> getDetailPlatform(UserLoginCacheDTO user, Long returnId);

    /**
     * 物流服务-分页获取待新增物流申请单
     * @author 伍将
     * @date 2020/12/8
     * @param user:
     * @param pageVO:
     * @return:
     **/
    Wrapper<PageData<ApplyOrderQueryVO>> pageByLogistics(UserLoginCacheDTO user, ApplyOrderPageVO pageVO);

    /**
     * 物流服务-获取退货申请单详情
     * @author 伍将
     * @date 2020/12/9
     * @param returnId:
     * @return:
     **/
    Wrapper<ApplyOrderQueryVO> pageDetailByLogistics(Long returnId);

    /**
     * 仓库服务-分页查询待新增退货发货单
     * @author 伍将
     * @date 2020/12/22
     * @param user:
     * @param pageVO:
     * @return:
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeAddReturnDeliveryByWarehouse(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 仓库服务-分页查询待新增退货入库单
     * @author 伍将
     * @date 2020/12/22
     * @param user:
     * @param pageVO:
     * @return:
     **/
    Wrapper<PageData<ReturnGoodsQueryVO>> pageToBeAddReturnStorageByWarehouse(UserLoginCacheDTO user, ReturnGoodsPageVO pageVO);

    /**
     * 根据退货申请单查询对应订单
     * @author 伍将
     * @date 2021/1/27
     * @param applyNo: 退货申请单号
     * @return 订单号列表
     **/
    Wrapper<List<String>> getOrderList(String applyNo);

    /**
     * 查询是否允许支付
     * @author 伍将
     * @date 2021/1/28
     * @param payVO:请求参数
     * @return 操作结果
     **/
    Wrapper<Boolean> isAllowPay(AllowPayVO payVO);

    /**
     * 根据退货订单ids,查询退货订单信息（状态）列表
     * @param returnGoodsIds
     * @return
     */
    Wrapper<List<ReturnGoodsInfoVO>> getOrderInfoListByIds(List<Long> returnGoodsIds);

    /**
     * 查询合同下的退货单
     * @param returnListGoodsDetailVO
     * @return
     */
    Wrapper<List<ReturnGoodsDetailListResponse>> getOrderListByContractId(ReturnListGoodsDetailVO returnListGoodsDetailVO);

    /**
     * 查询退货单列表-im
     * @param sysUser
     * @param request
     * @return
     */
    Wrapper<PageData<AfterSaleGoodsIMQueryVO>> pageByIM(UserLoginCacheDTO sysUser, AfterSaleGoodsIMPageVO request);

    /**
     * 查询收发货详情
     * @param sysUser
     * @param returnId
     * @param isSupplier
     * @return
     */
    Wrapper<ReturnGoodsBatchDetailVO> getReturnGoodsDeliveryOrReceiveDetail(UserLoginCacheDTO sysUser, Long returnId, boolean isSupplier);

    /**
     * 中止售后
     * @param sysUser
     * @param stopVO
     * @return
     */
    Wrapper<Void> stopReturnGoods(UserLoginCacheDTO sysUser, ReturnGoodsStopVO stopVO);

    /**
     * 查询退货单明细【活动执行明细用】
     * @param req
     * @return
     */
    Wrapper<List<ReturnGoodsTaxVO>> getOrderInfoListByIdsAndSkuIds(ReturnDetailReqVO req);
}
